<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()
const goBack = () => {
  router.go(-1)
}
const goHome = () => {
  router.push('/')
}
</script>

<template>
  <div class="not-found">
    <div class="background-image">
      <img src="@/assets/404.png" alt="404" />
    </div>
    <div class="content">
      <h1 class="title">404</h1>
      <div class="glitch-text">页面未找到</div>
      <p class="description">抱歉，您访问的页面不存在或已被移除</p>
      <div class="button-group">
        <a-button type="primary" class="action-btn" @click="goHome">返回首页</a-button>
        <a-button class="action-btn" @click="goBack">返回上页</a-button>
      </div>
    </div>
  </div>
</template>

<style scoped>
.not-found {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f1f1f 0%, #2d3436 100%);
  position: relative;
  overflow: hidden;
}

.background-image {
  position: fixed;
  right: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0.1;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.background-image img {
  width: 80%;
  height: auto;
  object-fit: contain;
}

.content {
  text-align: center;
  z-index: 1;
  padding: 2rem;
  margin-top: -10vh; /* 向上移动内容 */
}

.content .title {
  font-size: 9rem;
  font-weight: 900;
  margin: 0;
  background: linear-gradient(45deg, #00c6fb, #005bea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  text-shadow: 0 0 30px rgba(0, 198, 251, 0.3);
}

.content .glitch-text {
  font-size: 2.5rem;
  font-weight: 600;
  color: #ffffff;
  margin: 1rem 0;
  position: relative;
  animation: glitch 3s infinite;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.content .description {
  font-size: 1.2rem;
  color: #a0a0a0;
  margin-bottom: 2.5rem;
}

.content .button-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.content .button-group .action-btn {
  padding: 0.5rem 2rem;
  height: auto;
  font-size: 1rem;
}

.content .button-group .action-btn:hover {
  transform: translateY(-2px);
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

@keyframes glitch {
  0%, 100% {
    transform: skew(0deg);
    opacity: 1;
  }
  20% {
    transform: skew(-0.5deg);
    opacity: 0.9;
  }
  40% {
    transform: skew(0.5deg);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .content {
    margin-top: -5vh;
    padding: 1rem;
  }

  .content .title {
    font-size: 6rem;
  }
  
  .content .glitch-text {
    font-size: 1.8rem;
  }

  .content .description {
    font-size: 1rem;
  }

  .background-image img {
    width: 100%;
  }
}
</style>
